<?php

namespace App\Http\Controllers\Front;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use Swagger\Annotations as SWG;

class ComplaintController extends Controller
{
    /**
     * @SWG\Post(
     *     path="/front/complaint",
     *     tags={"用户相关"},
     *     summary="通用举报",
     *     description="举报通用接口",
     *     @SWG\Parameter(ref="#/parameters/auth"),
     *     @SWG\Parameter(name="target", in="formData", type="integer", description="投诉的目标id，如文章id"),
     *     @SWG\Parameter(name="type", in="formData", type="integer", description="分类2文章4网页"),
     *     @SWG\Parameter(name="item", in="formData", type="string", description="投诉的栏目"),
     *     @SWG\Parameter(name="content", in="formData", type="string", description="投诉的内容"),
     *     @SWG\Response(
     *          response="200",
     *          description="ok"
     *      )
     * )
     */
    public function store()
    {
        $target = \request('target');
        $type = \request('type');
        $item = \request('item');
        $content = \request('content');

        DB::table('complaint')->insert([
            'target_id' => $target,
            'type' => $type,
            'item' => $item,
            'content' => $content
        ]);
        return $this->success();
    }
}
